package com.marktotop.file.service.impl;

import com.marktotop.file.entity.TbFile;
import com.marktotop.file.mapper.TbFileMapper;
import com.marktotop.file.service.TbFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author WXLD
 * @data 2021/4/20 - 14:46
 */
@Service
public class TbFileServiceImpl implements TbFileService {

    @Autowired
    private TbFileMapper fileMapper;

    @Override
    public Boolean saveFileInfo(TbFile fileInfo) {
        return fileMapper.insertFile(fileInfo);
    }

    @Override
    public TbFile getOneById(Integer id) {
        return fileMapper.findFileById(id);
    }

    @Override
    public Boolean countDownloadNum(TbFile tbFile) {
        return fileMapper.downloadNumPlus(tbFile);
    }

    @Override
    public List<TbFile> getAllFiles() {
        return fileMapper.findAllFiles();
    }

    @Override
    public List<TbFile> getFileByQuery(TbFile file) {
        return fileMapper.findFileByQuery(file);
    }

    @Override
    public Boolean deleteFileInfo(Integer fileId) {
        return fileMapper.deleteFile(fileId);
    }
}
